
package com.huaweicloud.saaslanding.install.json;

import org.junit.jupiter.api.Test;

/**
 * 功能描述
 *
 * @since 2022-09-08
 */
class CceRequestBodyTest {

    @Test
    void printJson() {
        String template = "user nginx;\n" + "worker_processes auto;\n" + "error_log /var/log/nginx/error.log;\n"
            + "pid /run/nginx.pid;\n" + "\n" + "# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.\n"
            + "# include /usr/share/nginx/modules/*.conf;\n" + "\n" + "events {\n" + "    worker_connections 1024;\n"
            + "}\n" + "\n" + "http {\n"
            + "    log_format  main  '$remote_addr - $remote_user [$time_local] \"$request\" '\n"
            + "                      '$status $body_bytes_sent \"$http_referer\" '\n"
            + "                      '\"$http_user_agent\" \"$http_x_forwarded_for\"';\n" + "\n"
            + "    access_log  /var/log/nginx/access.log  main;\n" + "\n" + "    sendfile            on;\n"
            + "    tcp_nopush          on;\n" + "    tcp_nodelay         on;\n" + "    keepalive_timeout   65;\n"
            + "    types_hash_max_size 4096;\n" + "    client_max_body_size 2048m;\n" + "\n"
            + "    include             /etc/nginx/mime.types;\n" + "    default_type        application/octet-stream;\n"
            + "\n" + "    # Load modular configuration files from the /etc/nginx/conf.d directory.\n"
            + "    # See http://nginx.org/en/docs/ngx_core_module.html#include\n" + "    # for more information.\n"
            + "    # include /etc/nginx/conf.d/*.conf;\n" + "    \n" + "    server {\n" + "        listen       80;\n"
            + "        listen       [::]:80;\n" + "        server_name  _;\n" + "        \n"
            + "        root   /usr/share/nginx/html;\n" + "        \n" + "        location /basic-api/ {\n"
            + "           proxy_set_header Host $host;\n" + "           proxy_set_header X-Real-IP $remote_addr;\n"
            + "           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n" + "           # 后台接口地址\n"
            + "           proxy_pass http://${ip}:${port}/;\n" + "           proxy_redirect default;\n"
            + "           add_header Access-Control-Allow-Origin *;\n"
            + "           add_header Access-Control-Allow-Headers X-Requested-With;\n"
            + "           add_header Access-Control-Allow-Methods GET,POST,OPTIONS;\n" + "        }\n" + "    }\n"
            + "\t\n" + "    server {\n" + "\tlisten ${servicePort} ssl;\n" + "\tlisten [::]:${servicePort};\n"
            + "\tserver_name _;\n" + "\troot /usr/share/nginx/html;\n" + "\t\n" + "\t# 开启http_connect 为https做隧道\n"
            + "\tproxy_connect;\n" + "\tproxy_connect_allow 443;\n" + "\tproxy_connect_connect_timeout 10s;\n"
            + "\tproxy_connect_read_timeout 10s;\n" + "\tproxy_connect_send_timeout 10s;\n"
            + "\tssl_certificate ${nginxPemPath};\n" + "\tssl_certificate_key ${nginxKeyPath};\n"
            + "\tssl_client_certificate ${caCrtPath};\n" + "\tssl_verify_client off;\n" + "\t\n"
            + "\tssl_session_cache shared:SSL:1m;\n" + "\tssl_session_timeout 5m;\n" + "\tssl_protocols TLSV1.2;\n"
            + "\tssl_ciphers HIGH:!aNULL:!MD5:!EXPORT56:!EXP;\n" + "\tssl_prefer_server_ciphers on;\n" + "\t\n"
            + "\tlocation /basic-api/ {\n" + "           proxy_ssl_certificate ${nginxPemPath};\n"
            + "           proxy_ssl_certificate_key ${nginxKeyPath};\n"
            + "           proxy_ssl_trusted_certificate ${caCrtPath};\n" + "           proxy_set_header Host $host;\n"
            + "           proxy_set_header X-Real-IP $remote_addr;\n"
            + "           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n" + "\t\t\n"
            + "           # 后台接口地址\n" + "           proxy_pass https://${gatewayElbIp}:${gatewayElbPort}/;\n"
            + "           proxy_redirect default;\n" + "           add_header Access-Control-Allow-Origin *;\n"
            + "           add_header Access-Control-Allow-Headers X-Requested-With;\n"
            + "           add_header Access-Control-Allow-Methods GET,POST,OPTIONS;\n" + "        }\n" + "    }\n"
            + "}";

        System.out.println(template);
    }
}